package com.wanshi.controller;


import com.wanshi.entity.Products;
import com.wanshi.service.IProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 顽石教育-www.wanshi.com
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/products")
public class ProductsController {

    @Autowired
    private IProductsService productsService;
    @GetMapping("/list")
    public List<Products> list() {

        return productsService.list();
    }
    @GetMapping("/num/{orderid}")
    public List<Products> findProdsAndNumByOrderId(@PathVariable String orderid) {

        /*try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        return productsService.findProdsAndNumByOrderId(orderid);
    }

}

